"use strict";
//1. 函数 返回值 类型
function sayHi() {
    return '1111111';
}
var res1 = sayHi();
console.log(res1);
// 2.函数 形参 类型 
function jumpSan(City) {
    console.log(City);
}
//2.1 ts中 实参 必须 和 形参的 类型一致
jumpSan('青岛');
// jumpSan(111)
//2.2 ts中 实参 和 形参 的数量 必须一致
// jumpSan() //报错：实参太少
// jumpSan('青岛','111') //报错 实参太多
// function sum(a?:number,b?:number): void{
//   console.log(a,b);
// }
// sum(0)
// function sum(a: number = 10,b:number=20):number {
//   return a+b
// }
// console.log(sum(100,50));
// console.log(sum(100));
// console.log(sum());
// console.log(sum(undefined,50));
function sum(a, b) {
    var c = [];
    for (var _i = 2; _i < arguments.length; _i++) {
        c[_i - 2] = arguments[_i];
    }
    return a + b + c.reduce(function (prev, item) {
        return prev + item;
    }, 0);
}
console.log(sum(1, 2, 3, 4, 5, 6));
console.log(sum(1, 2));
// function buyGun(gunName: string, count?: number): void{
//   console.log(gunName,count ? count : '无');
// }
// function buyGun(gunName: string, count: number=1): void{
//   console.log(gunName,count );
// }
function buyGun(gunName, count) {
    if (gunName === void 0) { gunName = '222'; }
    if (count === void 0) { count = 1; }
    console.log(gunName, count);
}
// buyGun('1111',2)
buyGun();
